/*eslint-disable*/
import Vue from 'vue'
import Vuex from 'vuex'
// 持久化插件
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    username: '',
    password: '',
    filenameURL: '',
    password_status: false
  },
  plugins: [
    createPersistedState({
      paths: ['username', 'password', 'password_status']
    })
  ],
  mutations: {
    // 暂存当前查看的文件名
    setFilenameURL(state, filename) {
      state.filenameURL = `http://cloud.wydxsdac.top:8088/news?id=${filename}`
    },
    // 设置密码
    setUserPwd(state, user_setting) {
      state.username = user_setting.username
      state.password = user_setting.password
      state.password_status = user_setting.status
    },
    // 更改密码
    changeUserPwd(state, password) {
      state.password = password
    }
  },
  actions: {
  },
  modules: {
  }
})
